<?php

declare(strict_types=1);
/**
 * This file is part of habo_new_media.
 *
 * @link     https://www.berlen.cn/
 * @contact  tech@berlen.cn
 * @license  http://gitlab.rehou.cn/habo/habo_new_media/-/blob/master/README.md
 */
namespace app\service\ocean;

use app\enum\OeCodeEnum;
use app\service\BaseService;

class OceanService extends BaseService
{
    /**
     * 获取请求头部.
     * @param string $token
     * @return array|bool
     */
    public static function getHeader(string $token = '')
    {
        if (! $token) {
            return self::setError('未知巨量Token');
        }
        return [
            'Access-Token' => $token,
            'Content-Type' => 'application/json',
        ];
    }

    /**
     * 判断返回是否正确.
     * @param int $code
     * @return bool
     */
    public static function isResponseSuccess(int $code = -10000): bool
    {
        return $code == OeCodeEnum::SUCCESS;
    }
}
